package com.zuosh.utils;

import com.alibaba.fastjson.TypeReference;
import com.google.common.reflect.TypeToken;
import com.zuosh.domain.User;

import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;

/**
 * Created by zuoshuai on 2017/4/22.
 */
public class Test {
    public static void main(String[] args) {
        TypeReference<Person<User>> typeReference = new TypeReference<Person<User>>() {
        };
//        System.out.println();
//        Type genericSuperclass = new XX<String>() {
//        }.getClass().getGenericSuperclass();
//
//        Type actualTypeArguments = ((ParameterizedType) genericSuperclass).getActualTypeArguments()[0];
//        System.out.println(actualTypeArguments);
//
//        System.out.println(TypeReference.LIST_STRING);
//        Type type = new TypeReference<XX<Person>>() {
//        }.getType();
//        System.out.println(type);
    }


}

class XX<T> {
    private T data;
    private String name;

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
